package Order;

import java.util.Date;

import org.junit.Test;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import cn.tedu.store.bean.Order;
import cn.tedu.store.bean.OrderItem;
import cn.tedu.store.mapper.OrderMapper;

public class testOrder {
	@Test
	public void insertOrdertest(){
		AbstractApplicationContext ac=new ClassPathXmlApplicationContext("spring-dao.xml");
		OrderMapper om=ac.getBean("orderMapper",OrderMapper.class);
		Order order=new Order();
		order.setId(1);
		order.setTradetime(new Date());
		order.setUserid(1);
		om.insertOrder(order);
	}
	@Test
	public void insertOrderItemtest(){
		AbstractApplicationContext ac=new ClassPathXmlApplicationContext("spring-dao.xml");
		OrderMapper om=ac.getBean("orderMapper",OrderMapper.class);
		OrderItem ot=new OrderItem();
		ot.setCount(1);
		ot.setGoodsid("10000000");
		ot.setImage("123.png");
		ot.setOrderid(1);
		ot.setOrderstatus(1);
		ot.setPaymentstatus(1);
		ot.setPrice(1000);
		ot.setTitle("麻辣小面");
		ot.setUserid(1);
		om.insertOrderItem(ot);
	}
}
